package com.example.study.controller;

import com.example.study.api.UserRemoteClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @description：
 * @author: liqiancheng
 * @createTime: 2021/8/18 15:44
 **/
@RestController
public class UserConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private UserRemoteClient userRemoteClient;

    @GetMapping("/user/hello")
    public String callHello() {
        return restTemplate.getForObject("http://localhost:8081/user/hello", String.class);
    }

    @GetMapping("/feign/hello")
    public String feignHello() {
        return userRemoteClient.hello();
    }


}
